package gengine.clientside.forms;

import gengine.clientside.ClientApplication;
import gengine.clientside.console.ClientConsole;
import gengine.clientside.console.ClientConsolePacketProcessor;
import gengine.common.console.ConsolePanel;
import gengine.common.misc.BaseApplication;

import javax.swing.*;
import java.awt.*;

/**
 * User: arseniy
 * Date: 26.12.11
 */
public class MainForm extends JPanel{
    ClientApplication app = BaseApplication.getApplication();
    GamePanel panel=createGamePanel();
    ConsolePanel consolePanel;

    ClientInfoPanel clientInfoPanel = createPanelInfoPanel();

    public MainForm() {
        super(new GridBagLayout());
        ClientConsole cc = new ClientConsole();
        ClientConsolePacketProcessor cpp = new ClientConsolePacketProcessor();
        consolePanel = new ConsolePanel(cc,cpp);
        cpp.setPanel(consolePanel);

        GridBagConstraints c = new GridBagConstraints();
        c.gridx = 0;
        c.gridy = 0;
        c.ipady=200;
        //c.anchor = GridBagConstraints.HORIZONTAL;
        add(consolePanel,c);
        c = new GridBagConstraints();
        c.gridy =1;
        c.ipady = 200;
        //c.anchor = GridBagConstraints.HORIZONTAL;
        add(panel,c);
        c = new GridBagConstraints();
        c.gridy =2 ;
        //c.anchor = GridBagConstraints.HORIZONTAL;
        //c.ipady=5;
        add(clientInfoPanel,c);
    }

    private ClientInfoPanel createPanelInfoPanel() {
        return new ClientInfoPanel(app);
    }

    protected GamePanel createGamePanel() {
        return new GamePanel(app);
    }
}
